<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"  %>
<%@include file="/survey/include/head.jsp"%>
<script type="text/javascript" src="<%=request.getContextPath()%>/symanage/js/checkval.js"></script>
<body>
<div id="demo">
    <div id="mainbox">
        <div id="box">
<%@include file="/survey/include/top.jsp"%>
<script type="text/javascript" src="<%=request.getContextPath() %>/symanage/js/pingyin.js"></script>
<script type="text/javascript">

  function ob_str(obj){
	  if(obj.value==3){
		  document.getElementById("ob_size").value="23";
		  document.getElementById("ob_size").readonly="readonly";
		  document.getElementById("ob_size").style="background-color:#cccccc";
	  } else if(obj.value==5) {
		  document.getElementById("ob_size").value="18";
	  	  document.getElementById("ob_size").readonly="readonly";
		  document.getElementById("ob_size").style="background-color:#cccccc";
	  } 
	  else{
	   document.getElementById("ob_size").style="background-color:#ffffff";
	  }
		 changeTextState(obj.value);  
  }
  
  //编辑默认值的状态格式
  function changeTextState(ob){
  	var objtx = document.getElementById("df_text");
  	var objta = document.getElementById("df_textarea");
	var inputtx = document.getElementById("tx_default");
	var inputta = document.getElementById("ta_default");
  	if(ob==7){
	  	objtx.style.display="none";
	  	objta.style.display="";
		inputtx.disabled=true;
		inputta.disabled=false;
	}else{
	  	objtx.style.display="";
	  	objta.style.display="none";
		inputtx.disabled=false;
		inputta.disabled=true;
	}
  }
  
  function ob_onblur(){
	 /*  <!-- 汉字转拼音   -->    */
	  var ob_name=document.getElementById("ob_name").value;
	  var s = pinyin.go(ob_name); 
	  document.getElementById("ob_code").value=s;
	}
  function check(){
	  var ob_size = document.getElementById("ob_size").value;
	  var ob_code = document.getElementById("ob_code").value;
	  if(!isNum(ob_size,"资料长度"))
		  return false;
	  if(!isLetter(ob_code)){
		  return false;
	  }
	  return true;
  }
</script>
           <div class="right">
                <div class="banner"><img src="<%=request.getContextPath() %>/survey/images/about_banner.jpg" width="703" height="183" /></div>
             <div class="tj_news" style="float:left; width:97%;">
               <h1>添加调查资料</h1><a name="question"></a>
               <div class="dd">
  <form  method="post" action="<%=request.getContextPath() %>/symanage/objectable/saveobj.htm" onsubmit="return check()">
<p> <span class="STYLE2"> 资料名称:</span>
<input type="hidden" value="<%=request.getParameter("sy_id") %>" name="sy_id">
                  <label>
                  <input name="ob_name" type="text" id="ob_name" size="20" onBlur="ob_onblur()"/>
                  </label>
              </p>
<p>&nbsp;</p>
<span id="ob_pingyin"></span>
<p class="STYLE2">资料类型:
  <label>
  <select name="ob_type" size="1" id="ob_type" onchange="ob_str(this)">
    <option value="1" selected="selected">字符串</option>
    <option value="2">数字</option>
    <option value="3">时间类型</option>
    <option value="4">大文本</option>
    <option value="5">身份证</option>
    <option value="6">上传图形</option>
    <option value="7">参数选择</option>
  </select> 
  </label>
</p>
<p class="STYLE2">&nbsp;</p>
<p class="STYLE2">资料长度:
  <label>
  <input name="ob_size" type="text" id="ob_size" size="20" />
  </label>
</p>
<p class="STYLE2">&nbsp;</p>
<p class="STYLE2">字段编码:
  <label>
  <input name="ob_code" type="text" id="ob_code" size="20"/>
  </label>
</p>
<p class="STYLE2">&nbsp;</p>
<div id="df_text">
<!-- 默认值 -->
<p class="STYLE2">&nbsp;&nbsp;默认值 :
  <label>
  <input name="ob_default" type="text" id="tx_default" size="20"/>
  </label>
</p>
</div>
<!-- 默认值 -->
<div id="df_textarea" style="display:none;">
<p class="STYLE2">&nbsp;&nbsp;默认值 :
  <label>
  <textarea rows="3" cols="60" id="ta_default" name="ob_default"></textarea>如果是参数形式，请按照换行的格式填写选择项。
  </label>
</p>
</div> 
<p class="STYLE2">&nbsp;</p>
<p class="STYLE2">资料排序:
  <label>
  <input name="ob_order" type="text" id="ob_order" size="20" />
  </label>
</p>
<p>&nbsp;</p>
      <input type="submit" name="button" id="button" value="确认提交" />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    
         <input type="button" name="reset" id="button2" value="返回" onclick="location.href='<%=request.getContextPath() %>/symanage/baseinfo/list.htm'">   
</form>
<p>&nbsp;</p>
<table width="700" border="1">
  <tr>
    <td width="64"><div align="center">资料名称</div></td>
    <td width="60"><div align="center">资料类型</div></td>
    <td width="30"><div align="center">资料长度</div></td>
    <td width="120"><div align="center">字段编码</div></td>
    <td width="200"><div align="center">默认值</div></td>
    <td width="30">资料排序</td>
    <td width="30"><div>启用</div></td>
    <td width="120"><div align="center">所属问卷</div></td>
     <td width="129"><div align="center">操作</div></td>
  </tr>
  <c:forEach var="ls" items="${ls}">
  <tr>
     
    <td><label> ${ls.ob_name }</label></td>
    <td><label> ${obtype[ls.ob_type] }</label></td>
    <td>${ls.ob_size }</td>
    <td>${ls.ob_code }</td>
    <td>${ls.ob_default }</td>
    <td>${ls.ob_order }</td>   
    <td><c:if test="${ls.ob_isuse=='0'}">启用</c:if><c:if test="${ls.ob_isuse=='1'}">停用</c:if></td> 
    <td>${bs.sy_name }</td>
    <td align="center">
    <a href="#" onclick="if(confirm('您确认删除该资料对象吗？')){location.href='deleobj.htm?id=${ls.id}&sy_id=${ls.sy_id}'}"><img src="<%=request.getContextPath() %>/symanage/js/kindeditor/plugins/image/images/del.png"></a>
     <a href="eidobj.htm?id=${ls.id }" ><img src="<%=request.getContextPath() %>/symanage/js/kindeditor/plugins/image/images/edit.png" ></a>
    <a href="#" onclick="if(confirm('您确认更改当前状态？')){location.href='isuse.htm?id=${ls.id}'}">
    <c:if test="${ls.ob_isuse=='1'}"><img src="<%=request.getContextPath() %>/symanage/js/kindeditor/plugins/image/images/star.png" title="启用"></c:if>
    <c:if test="${ls.ob_isuse=='0'}"><img src="<%=request.getContextPath() %>/symanage/js/kindeditor/plugins/image/images/stop.png" title="停用"></c:if></a>
    </td>

  </tr>
  </c:forEach>
</table>
 <p>&nbsp;</p>
  <p>&nbsp;</p>
                 </div>
                </div>
                <div class="clear"></div>
		</div>
            <div class="clear"></div>
<%@include file="/survey/include/bottom.jsp"%>
        </div>
    </div>
</div>
</body>
</html>

